//
//  XWTextFieldViewController.m
//  block的用法
//
//  Created by 谢伟 on 16/3/21.
//  Copyright © 2016年 wei.xie. All rights reserved.
//

#import "XWTextFieldViewController.h"

@interface XWTextFieldViewController ()

@property (nonatomic,strong) UITextField *inputTF;

@end

@implementation XWTextFieldViewController

- (void)returnText:(ReturnTextBlock)block {
    self.returnTextBlock = block;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.inputTF = [[UITextField alloc] initWithFrame:CGRectMake(30, 200, 250, 44)];
    self.inputTF.backgroundColor = [UIColor lightGrayColor];
    self.inputTF.placeholder = @"请输入文本";
    [self.view addSubview:_inputTF];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    
    if (self.returnTextBlock != nil) {
        self.returnTextBlock(self.inputTF.text);
    }

}


@end
